package com.custom.base.view

import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.Adapter
import android.widget.HorizontalScrollView

/**
 * 作者：.
 * 时间：2016/12/8.
 * 说明：用HorizontalScrollView绑定listview
 */

class ListViewHorizontalScrollView(context: Context, attrs: AttributeSet) :
    HorizontalScrollView(context, attrs) {

    private var listView = ListViewLinearLayoutView(context, attrs)

    init {
        listView.setOrientation(ListViewLinearLayoutView.OrientationType.HORIZONTAL)
        addView(listView)
    }
    /**
     * 绑定布局
     */
    fun setAdapter(adapter: Adapter) {
        listView.setAdapter(adapter)
    }

    /**
     * 添加View
     *
     * @param list
     */
    fun addView(list: List<View>) {
        listView.addView(list)
    }
}
